/**
 * 
 */
package andersonb.managedbeans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

/**
 * @author Anderson Bernardo
 * @since 02/05/2013
 */
@ManagedBean
@SessionScoped
public class ImmediateTestBean implements Serializable {
	private static final long serialVersionUID = 5893509559337506047L;

	private ArrayList<String[]> list = new ArrayList<String[]>(10);

	private List<String[]> selections;

	public ImmediateTestBean() {

		for (int i = 0; i < 10; i++) {
			String[] row = new String[] { "valor 1" + i, "valor 2", "valor 3" };

			list.add(row);
		}
	}

	public void atualizarModel() {
		System.out.println(list);
		for (Iterator<String[]> it = list.iterator(); it.hasNext();) {
			String[] row = it.next();
			if (selections.contains(row)) {
				it.remove();
			}
		}
	}

	public ArrayList<String[]> getList() {
		return list;
	}

	public void setList(ArrayList<String[]> list) {
		this.list = list;
	}

	/**
	 * @return the selections
	 */
	public List<String[]> getSelections() {
		return selections;
	}

	/**
	 * @param selections
	 *            the selections to set
	 */
	public void setSelections(List<String[]> selections) {
		this.selections = selections;
	}

}
